﻿namespace Game.Lib.ztPackets
{
    public class TestMessagePacket : Packet
    {
        public string Data;

        public TestMessagePacket()
        {
            Data = "Test";
        }

        public TestMessagePacket(string data)
        {
            Data = data;
        }

        public override int Length
        {
            get
            {
                return 4 + Utils.UTF8.GetByteCount(Data);
            }
        }

        public override byte[] ToBytes()
        {
            return GetTotalBuffer(Utils.GetBytes(Data));
        }

        public override void FromBytes(byte[] data, int pos)
        {
            Data = Utils.GetString(data, pos);
        }
    }
}
